<?php include 'header.php' ?>
    <div id="dialog" title="Confirm Dialog">
        <p> Are you sure to delete it?</p>
        <button onclick="deleteProduct();">Yes</button>
        <button onclick="closeDialog()">No</button>
    </div>

    <section class="main-content">
        <article>
            <header>
                <h1>Danh Mục Sản Phẩm</h1>
            </header>
            <div class="clear"/>

            <section class="list-content">
                <div id="product_list">
                </div>
                <div class="clear"/>
            </section>

            <div class="clear"/>
            <section class="list-content">
                <header>
                    <h1>Thông tin sản phẩm</h1>
                </header>
                <div id="product_form">
                    <p id="message"></p>

                    <form action="">
                        <div>
                            <input type="hidden" id="id_product">
                            <label for="name_product">Tên sản phẩm: </label>
                            <input type="text" id="name_product" name="name_product" maxlength="100"
                                   placeholder="Nhập tên sản phẩm" required="true" autofocus="true" size="50">
                            <br/><br/>

                            <label for="ime_product">Mã sản phẩm: </label>
                            <input type="text" onsubmit="$('#ime_product').val(generateIMEProduct());"
                                   disabled="disabled" id="ime_product" name="ime_product" size="50">
                            <br/><br/>

                            <label for="price_product">Giá sản phẩm: </label>
                            <input type="number" required="true" id="price_product" name="price_product" size="50"
                                   maxlength="10" value="0">
                            <br/><br/>

                            <label for="cat_product">Danh mục sản phẩm: </label>
                            <select id="cat_product" name="cat_product" required="required">
                            </select>
                            <br/><br/>

                            <label for="brief_product">Mô tả ngắn gọn: </label>
                            <input id="brief_product" name="brief_product" size="50"/>
                            <br/><br/>

                            <label for="content_product">Nội dung: </label>
                            <textarea id="content_product" name="content_product" class="ckeditor">
                            </textarea>

                            <br/>
                            <label for="image_url">Hinh đại diện: </label>
                            <input type="text" id="image_url" name="image_url" placeholder="Nhập ảnh đại diện"
                                   value="../images/default.jpg" size="50" disabled="disabled">
                            <input type="button" value="Browsers" onclick="browserImage();"/>
                            <br/>

                            <div id="sample_image">
                                <img src="../images/default.jpg">
                            </div>
                        </div>
                        <div class="clear"/>
                        <div>
                            <input type="submit" value="Lưu lại" onclick="createProduct();return false;"
                                   style="width: 100px">
                            <input type="reset" value="Reset" onclick="resetFormProduct();return false;"
                                   style="width: 100px;color: red;margin-left: 20px;">
                        </div>
                    </form>

                    <div class="clear"/>
                </div>
            </section>
        </article>
    </section>

<?php include 'footer.php' ?>